package day0613

import akka.actor.{Actor, ActorSystem, Props}

/**
  * @program: hadoop
  * @description: Actor---AKKA(AKKA是用于A和B直接传递消息的)
  * @author: Qiang.Ye
  * @date: 2019-06-14 07:55
  *
  *  JAVA并发---synchronized
  *  SCALA------actor
  *
  **/

class HelloActor extends Actor{
  override def receive: Receive = {
    /**
      * 使用case来处理不同类型的信息
      */
    case "Hello" => println("您好！")
    case "hello" => println("你好！")
    case _=> println("你是？")
  }
}

object Demo01 {

  def main(args: Array[String]): Unit = {
    //新建一个ActorSystem
    val system = ActorSystem("HelloSystem")
    val helloActor = system.actorOf(Props[HelloActor],name = "helloactor")

    helloActor  ! "hello"
  }

}
